﻿/*----------------------------------------------------------------------------
|
|  File Name: VIA_CDLL.h 
|
|  Comment:   External interface for CANoe\CANalyzer CAPL DLLs (CDLL), that 
|             makes some of the VIA APIs available also for capl dlls                            
|
|-----------------------------------------------------------------------------
|               A U T H O R   I D E N T I T Y
|-----------------------------------------------------------------------------
| Initials     Name                      Company
| --------     ---------------------     -------------------------------------    
| As           Stefan  Albus             Vector Informatik GmbH  

|-----------------------------------------------------------------------------
|               R E V I S I O N   H I S T O R Y
|-----------------------------------------------------------------------------
| Date         Ver  Author  Description
| ----------   ---  ------  --------------------------------------------------
| 2003-08-27   1.0   As     Creation
| ...
| sometime     2.0          By definition version 2.0 will be the first release 
| in the                    of VIA_CDLL interface, that is not longer compatible  
| future                    with version 1.x 
|                           
|-----------------------------------------------------------------------------
|               C O P Y R I G H T
|-----------------------------------------------------------------------------
| Copyright (c) 1994 - 2003 by Vector Informatik GmbH.  All rights reserved.
-----------------------------------------------------------------------------*/



#ifndef VIA_CDLL_H
#define VIA_CDLL_H


#ifndef VIA_H
  #include "VIA.h"
#endif


// ============================================================================
// Version of the interfaces, which are declared in this header
// See  REVISION HISTORY for a description of the versions
// ============================================================================


const int VIACDLLMajorVersion = 1;
const int VIACDLLMinorVersion = 0;


// ============================================================================
// 一个VIACapl类的对象代表一个CAPL程序。通过使用这个
// 对象，你可以获得在CAPL程序中实现的功能。
//
// 在测量运行时，每个加载的capl程序都由一个唯一的句柄（VIACaplHandle）识别。CAPL程序员通过
// 调用capl函数'registerCAPLDll'获得这个句柄，而DLL程序员在调用C-fucntion'VIARegisterCDLL'时从VIACapl获得。
// ============================================================================



typedef uint32 VIACaplHandle;     // unique handle of a capl program


class VIACapl
{
public:
   //  获取该接口对象的版本（VIACDLLMajorVersion和
   //  VIACDLLMinorVersion）。
   VIASTDDECL GetVersion (int32* major, int32* minor) =0;

   // 
   VIASTDDECL GetCaplHandle (uint32* handle) =0;

   // 获取一个CAPL函数句柄。该句柄在测量结束或调用ReleaseCaplFunction之前一直有效。
   VIASTDDECL GetCaplFunction(VIACaplFunction** caplfct,     // the created handle
                              const char* functionName) =0;  // name of the function

   // Release the CAPL function handle received by 'GetCaplFunction' (see above)
   // Call this method at or before the end of the measurement for every CAPL 
   // function handle, that you have asked for.
   VIASTDDECL ReleaseCaplFunction(VIACaplFunction* caplfct) =0;
};



// ==========================================================================
// VIARegisterCDLL，一个必须由每个CAPL
// DLL实现的设置函数，它将使用'VIA_CDLL.h'的服务 
// 下面的C函数是用来初始化DLL的。当一个CAPL程序执行 "registerCAPLDll "函数时，
// 它被调用。
// ==========================================================================


VIACLIENT(void) VIARegisterCDLL (VIACapl* service);
#endif

